<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
<head>
    <meta charset="utf-8">
    <title><spring:message code="news.title" /></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="keywords" content="<spring:message code="news.keywords" />">
    <meta name="description" content="<spring:message code="news.description" />">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="/common/bootstrap/css/bootstrap.css?VERSION=0.01">
    <link rel="stylesheet" href="/assets/2.0/css/common.css?VERSION=0.01">
    <link rel="stylesheet" href="/assets/2.0/css/news.css?VERSION=0.01">
</head>
<body>

<!--导航条-->
<jsp:include page="../include/index_header.jsp"></jsp:include>

<div class="bg-content">
</div>

<div class="wrapper">
    <div class="content">
        <div class="left">
            <article>
                <header>
                    <div class="hot-title">热门资讯</div>
                </header>
                <c:forEach var="hotNews" items="${hotNewsList}" varStatus="status">
                    <div class="hot-column" title="${hotNews.title}">
                        <span>${status.index+1}.</span>
                        <a href="/news/${hotNews.id}.html">
                                ${hotNews.title}
                        </a>
                    </div>
                </c:forEach>
            </article>
        </div><!--
            -->
        <div class="right">
            <div class="list-header">
                <div class="list-header-nav">
                    <span class='cursor-pointer <c:if test="${empty newsType}">condition-selected</c:if>' onclick="window.location.href='/news.html'">全部</span>
                    <span class='cursor-pointer <c:if test="${newsType == 1}">condition-selected</c:if>' onclick="window.location.href='/news?type=1'">新闻资讯</span>
                    <span class='cursor-pointer <c:if test="${newsType == 2}">condition-selected</c:if>' onclick="window.location.href='/news?type=2'">行业资讯</span>
                </div>
            </div>

            <div>
                <c:choose>
                    <c:when test="${empty newsPage.records}"><h4 style="text-align: center">暂无相关资讯，敬请期待...</h4></c:when>
                    <c:otherwise>
                        <c:forEach var="news" items="${newsPage.records}">
                            <div class="list-column">
                                <div class="left-cell">
                                    <a href="/news/${news.id}.html">
                                        <img src="${news.thumbnailUrl}" alt="news">
                                    </a>
                                </div>

                                <div class="right-cell">
                                    <a href="/news/${news.id}.html" class="right-title">${news.title}</a>
                                    <a href="/news/${news.id}.html" class="right-content">${news.sketch}</a>
                                    <p>
                                            ${news.created.substring(0,10)}
                                    </p>
                                </div>
                            </div>
                        </c:forEach>
                    </c:otherwise>
                </c:choose>
            </div>

            <c:if test="${not empty newsPage.records && newsPage.total > newsPage.size}">
                <div aria-label="Page navigation" class="nav text-center" style="user-select: none;">
                    <ul class="pagination" style="margin-top: 45px;margin-bottom: 0;">
                        <c:if test="${newsPage.current == 1}"><li class='cursor-pointer disabled'><a>首页</a></li></c:if>
                        <c:if test="${newsPage.current > 1}"><li class='cursor-pointer'><a href="/news/hotkeyword.html?keyword=${keyword}&current=1">首页</a></li></c:if>

                        <c:if test="${newsPage.current == 1}"><li class='cursor-pointer disabled'><a>上一页</a></li></c:if>
                        <c:if test="${newsPage.current > 1}"><li class='cursor-pointer'><a href="/news/hotkeyword.html?keyword=${keyword}&current=${newsPage.current - 1}">上一页</a></li></c:if>

                        <c:choose>
                            <c:when test="${newsPage.pages > 10 && newsPage.current <= 10}">
                                <c:forEach var="i" begin="1" end="10">
                                    <li class='cursor-pointer'>
                                        <a href="/news/hotkeyword.html?keyword=${keyword}&current=${i}" <c:if test="${newsPage.current == i}">style="color: #fff;background-color: #f2c421;"</c:if>>${i}</a>
                                    </li>
                                </c:forEach>
                                <li><a>...</a></li>
                            </c:when>
                            <c:when test="${newsPage.pages > 10 && newsPage.current > 10}">
                                <li><a>...</a></li>
                                <c:forEach var="i" begin="11" end="${newsPage.pages}">
                                    <li class='cursor-pointer'>
                                        <a href="/news/hotkeyword.html?keyword=${keyword}&current=${i}" <c:if test="${newsPage.current == i}">style="color: #fff;background-color: #f2c421;"</c:if>>${i}</a>
                                    </li>
                                </c:forEach>
                            </c:when>
                            <c:otherwise>
                                <c:forEach var="i" begin="1" end="${newsPage.pages}">
                                    <li class='cursor-pointer'>
                                        <a href="/news/hotkeyword.html?keyword=${keyword}&current=${i}" <c:if test="${newsPage.current == i}">style="color: #fff;background-color: #f2c421;"</c:if>>${i}</a>
                                    </li>
                                </c:forEach>
                            </c:otherwise>
                        </c:choose>

                        <c:if test="${newsPage.current == newsPage.pages}"><li class='cursor-pointer disabled'><a>下一页</a></li></c:if>
                        <c:if test="${newsPage.current < newsPage.pages}"><li class='cursor-pointer'><a href="/news/hotkeyword.html?keyword=${keyword}&current=${newsPage.current + 1}">下一页</a></li></c:if>

                        <c:if test="${newsPage.current == newsPage.pages}"><li class='cursor-pointer disabled'><a>末页</a></li></c:if>
                        <c:if test="${newsPage.current < newsPage.pages}"><li class='cursor-pointer'><a href="/news/hotkeyword.html?keyword=${keyword}&current=${newsPage.pages}">末页</a></li></c:if>

                            <%--<li><span>共 ${casePage.pages} 页</span></li>--%>
                    </ul>
                </div>
            </c:if>
        </div>
    </div>
</div>

<!-- 页脚 -->
<jsp:include page="../include/index_footer.jsp"></jsp:include>
</body>
</html>
